package na.learn.java;

public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		SuperBase a1 = new SuperBase();
		SuperBase a2 = new Base();
		Base a3 = new Derived();
		
		a1.print(new Base());
		a2.print(new Derived());
		a3.print(new Derived());
		
		

	}

}

class SuperBase {
	void print(SuperBase sb) {System.out.println("SB");}
}

class Base extends SuperBase{
	void print(Base sb) {System.out.println("B");}
}

class Derived extends Base{
	void print(Derived sb) {System.out.println("D");}
}